﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AspNetCs.Bll;
using AspNetCs.Model;
using AspNetCs.Common;
public partial class Users_EditPwd : BasePage
{
    protected Users UserBll = new Users();
    protected void Page_Load(object sender, EventArgs e)
    {
        CheckUserExit("Login.Aspx?ReUrl=" + configInfo.InstallDir + "Users/EditPwd.Aspx", "", true);


    }
    protected void Button1_Click(object sender, EventArgs e)
    {



        Users_Model md = Base_GetUserInfo;
        md.UserId = Base_GetUserInfo.UserId;
        if (md.Pwd != EncryptString.md5(Txt_OldPwd.Text))
        {
            ResultStr("EditPwd.Aspx", "旧密码输入不正确，修改失败!", true);
        }

        md.Pwd = Txt_NewPwd.Text == "" ? Base_GetUserInfo.Pwd : EncryptString.md5(Txt_NewPwd.Text);

        if (UserBll.updatePwd(md) > 0)
        {
            ResultStr("EditPwd.Aspx", "修改成功!", true);

        }
        else
        {
            ShowMsgBack("密码修改失败,请仔细检查错误原因");
        }
    }
}
